package com.forg.spring.boot.application;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 
 * @author forgkan
 *
 *  @EnableScheduling ensures that a background task executor is created. Without it, nothing gets scheduled.
 */
@SpringBootApplication
@EnableScheduling
@ComponentScan("com.forg.spring")
@ImportResource({"classpath:dubboContext.xml"})
public class Application implements CommandLineRunner {

    @SuppressWarnings("unused")
    public static void main(String[] args) {
        
        ApplicationContext ctx = SpringApplication.run(Application.class, args);
        
//        System.out.println("Let's inspect the beans provided by Spring Boot:");

//        String[] beanNames = ctx.getBeanDefinitionNames();
//        Arrays.sort(beanNames);
//        for (String beanName : beanNames) {
//            System.out.println(beanName);
//        }
        
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("spring-boot-exp start to run...");
        
    }
}
